/**
 * @description: common公共参数校验
 * @version: 0.0.1
 * @author: ljr
 * @Date: 2023-06-08 14:07:35
 */

import { Rule, RuleType } from '@midwayjs/validate';

export const requiredString = RuleType.string().required();
export const requiredNumber = RuleType.number().required();
export const requiredObject = RuleType.object().required();
export const requiredAny = RuleType.any().required();

//  分页
export class PageDTO {
  @Rule(requiredNumber)
  pageSize: number;
  @Rule(requiredNumber)
  pageNum: number;
  @Rule(RuleType.any())
  searchKey: any;
}

//  id
export class IdDTO {
  @Rule(requiredNumber)
  id: number;
}

//  unionId
export class UnionIdDTO {
  @Rule(requiredString)
  unionId: string;
}

export class Page2DTO {
  @Rule(requiredNumber)
  pageSize: number;
  @Rule(requiredNumber)
  pageNum: number;
}